/**************************************************************************
 *         Copyright(c) 2007 by Sunplus mMedia  Technology Co., Ltd.       *
 *                                                                         *
 *  This software is copyrighted by and is the property of Sunplus mMedia  *
 *  Technology Co., Ltd. All rights are reserved by Sunplus mMedia Techno- *
 *  logy Co., Ltd. This software may only be used in accordance with the   *
 *  corresponding license agreement. Any unauthorized use, duplication,    *
 *  distribution, or disclosure of this software is expressly forbidden.   *
 *                                                                         *
 *  This Copyright notice "M U S T" not be removed or modified without     *
 *  prior written consent of Sunplus mMedia Technology  Co., Ltd.          *
 *                                                                         *
 *  Sunplus mMedia Technology Co., Ltd. reserves the right to modify this  *
 *  software without notice.                                               *
 *                                                                         *
 *  Sunplus mMedia Technology Co., Ltd.                                    *
 *  19-1, Innovation First Road, Science-Based Industrial Park,            *
 *  Hsin-Chu, Taiwan, R.O.C.                                               *
 *                                                                         *
 **************************************************************************/
#ifndef __AAA_API_H__
#define __AAA_API_H__

/**************************************************************************
 *                           C O N S T A N T S                            *
 **************************************************************************/
#define AWB_CTC_PARAM_LENGTH 256

/**************************************************************************
 *                              M A C R O S                               *
 **************************************************************************/

/**************************************************************************
 *                          D A T A    T Y P E S                          *
 **************************************************************************/
typedef struct _AEstr{
unsigned short ev;
unsigned long shutter;
unsigned short gain;
unsigned short iris;
}AEstr;

typedef struct _AECQ{
	unsigned long shutter;
	unsigned short gain;
}AECQ;

typedef struct _AWBCTT_s{
	UINT16 awbctt_format_version;	/* essential, 0x1001 */
	UINT16 parameter_version;
	UINT16 a_rgain; 				/* essential, base is 256*/
	UINT16 a_bgain; 				/* essential, base is 256*/
	
	UINT16 cw_rgain; 				/* essential, base is 256 */
	UINT16 cw_bgain; 				/* essential, base is 256 */
	UINT16 d_rgain; 				/* essential, base is 256 */
	UINT16 d_bgain; 				/* essential, base is 256 */
	
	UINT16 res1_rgain; 				/* essential, base is 256 */
	UINT16 res1_bgain; 				/* essential, base is 256 */
	UINT16 res2_rgain; 				/* essential, base is 256 */
	UINT16 res2_bgain; 				/* essential, base is 256 */
	
	UINT16 a_upright_rgain; 		/* essential, base is 256 */
	UINT16 a_upright_bgain; 		/* essential, base is 256 */
	UINT16 a_downleft_rgain; 		/* essential, base is 256 */
	UINT16 a_downleft_bgain; 		/* essential, base is 256 */
	
	UINT16 cw_upright_rgain; 		/* essential, base is 256 */
	UINT16 cw_upright_bgain; 		/* essential, base is 256 */
	UINT16 cw_downleft_rgain; 		/* essential, base is 256 */
	UINT16 cw_downleft_bgain; 		/* essential, base is 256 */
	
	UINT16 d_upright_rgain; 		/* essential, base is 256 */
	UINT16 d_upright_bgain; 		/* essential, base is 256 */
	UINT16 d_downleft_rgain; 		/* essential, base is 256 */
	UINT16 d_downleft_bgain; 		/* essential, base is 256 */
		
	UINT16 outdoor_a_upright_rgain; /* essential, base is 256 */
	UINT16 outdoor_a_upright_bgain; /* essential, base is 256 */
	UINT16 outdoor_a_downleft_rgain;/* essential, base is 256 */
	UINT16 outdoor_a_downleft_bgain;/* essential, base is 256 */
	
	UINT16 outdoor_cw_upright_rgain; /* essential, base is 256 */
	UINT16 outdoor_cw_upright_bgain; /* essential, base is 256 */
	UINT16 outdoor_cw_downleft_rgain;/* essential, base is 256 */
	UINT16 outdoor_cw_downleft_bgain;/* essential, base is 256 */
	
	UINT16 outdoor_d_upright_rgain; /* essential, base is 256 */
	UINT16 outdoor_d_upright_bgain; /* essential, base is 256 */
	UINT16 outdoor_d_downleft_rgain;/* essential, base is 256 */
	UINT16 outdoor_d_downleft_bgain;/* essential, base is 256 */
	
	UINT16 outdoor_gid_down_limit;
	UINT16 outdoor_enable_0;
	UINT16 outdoor_enable_1;
	UINT16 outdoor_enable_2;
	
	UINT16 outdoor_enable_3;
	UINT16 outdoor_enable_4;
	UINT16 outdoor_enable_5;
	UINT16 outdoor_enable_6;
	
	UINT16 wp_criteria; /* essential */
	UINT16 dark_compensate_gid; /* 0 is disable, other will be criteria. */
	UINT16 dark_compensate_rgain; /* base is 256 */
	UINT16 dark_compensate_bgain; /* base is 256 */
	
	UINT16 res[4];
}_AWBCTT_t;

/**************************************************************************
 *                         G L O B A L    D A T A                         *
 **************************************************************************/
extern UINT8	G_AWBEN;
extern UINT8	G_AEEN;
extern UINT8	G_AWBCount;
extern UINT8	G_3AFlag;
extern UINT8	G_3ACount;

/**************************************************************************
 *                 E X T E R N A L    R E F E R E N C E S                 *
 **************************************************************************/

/**************************************************************************
 *               F U N C T I O N    D E C L A R A T I O N S               *
 **************************************************************************/
UINT8 AAA_AECOUNT(void);
void AAA_AWBModeSet(UINT8 mode);
UINT8 AAA_AEMeterChange(UINT8 mode);
UINT8 AAA_AEStdLumiSet(UINT8 lumi);
UINT8 AAA_AEExpComp(UINT8 light);
UINT8 AAA_FrameRateChange(UINT16 framerate);
void AAA_AWBGainGet(UINT16 *rgain, UINT16 *bgain, UINT16 *ggain); // hlc 0320 add
void AAA_AEForceSet(void);
void AAA_FrmInvalid(void);
void AAA_AEModeEnable(UINT8 mode);
void AAA_AWBModeEnable(UINT8 mode);
void AAA_AEGlobalGainEnable(UINT8 GlbGnEn);   //Tq@20090409
void AAA_AWBWindowReadRGB(void);
UINT8 AAA_AWBCOUNT(void);
void AAA_AEWinConfig(void);
void AAA_AWBWinConfig(void);
void AAA_AWBVideoReordStatusSet(UINT8 isRecordOn);

#endif //__AAA_API_H__

